// 向右39
var mytank = document.getElementById('mytank');
window.addEventListener(
	'keydown',
	function(e) {
		console.log(e.keyCode);
		// 向右
		if (e.keyCode == 39 || e.keyCode == 68 || e.keyCode == 100) {
			mytank.setAttribute("src", "images/right.png")
			mytank.style.left = (mytank.offsetLeft + 10) + 'px';
		}
		// 向上                                             179000910陈润强
		if (e.keyCode == 38 || e.keyCode == 119 || e.keyCode == 87) {
			mytank.setAttribute("src", "images/up.png")
			mytank.style.top = (mytank.offsetTop - 10) + 'px';
		}
		// 向下
		if (e.keyCode == 40 || e.keyCode == 115 || e.keyCode == 83) {
			mytank.setAttribute("src", "images/down.png")
			mytank.style.top = (mytank.offsetTop + 10) + 'px';
		}
		// 向左
		if (e.keyCode == 37 || e.keyCode == 65 || e.keyCode == 97) {
			mytank.setAttribute("src", "images/left.png")
			mytank.style.left = (mytank.offsetLeft - 10) + 'px';
		}
		// 判断坦克是否越界,越界则在另外一边重新进入边界
		if (mytank.offsetLeft > window.innerWidth) {
			mytank.style.left = 0 + 'px';
		}
		if (mytank.offsetLeft < 0) {
			mytank.style.left = 1920 + 'px';
		}
		if (mytank.offsetTop > window.innerHeight) {
			mytank.style.top = 0 + 'px';
		}
		if (mytank.offsetTop < 0) {
			mytank.style.top = 969 + 'px';
		}
	});
// 按钮一
let btn1 = document.querySelector("#btn1");
btn1.onclick = function() {
	alert("javascript事件测试一");
};
// 179000910陈润强
// 按钮二
let btn2 = document.querySelector("#btn2");
btn2.ondblclick = function() {
	btn2.value = "按钮二测试";
};
// 按钮三
let btn3 = document.querySelector("#btn3");
btn3.onclick = function() {
	alert("javascript事件测试三");
};
btn3.onmousemove = function() {
	btn3.style = "color:white;background:aqua";
};
btn3.onmouseout = function() {
	btn3.style = "null";
};
// 禁用右键菜单
document.oncontextmenu = function() {
	event.returnValue = false;
};
